<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
                template="./master/MasterPage.xhtml"


                xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
                xmlns:h="http://xmlns.jcp.org/jsf/html"

                xmlns:p="http://xmlns.jcp.org/jsf/passthrough"
                xmlns:f="http://xmlns.jcp.org/jsf/core">


    <ui:define name="content">
        <!-- Page Content -->
        <div class="container">
            <ol class="breadcrumb" style="border-left: 3px solid #e54e53;">
                <li><a>SEARCH RESULTS: #{eventSearchController.parameter} (#{eventSearchController.eventLibraryListSearch.size()})</a></li>
            </ol>
        </div>
        <div class="container">
            <div class="row previews">
                <c:choose>
                    <c:when test="#{eventSearchController.eventLibraryListSearch !=null}">
                        <c:forEach var="ev" items="#{eventSearchController.eventLibraryListSearch}">
                            <h:form>
                                <div class="col-lg-4 col-sm-6">
                                    <div class="thumbnail" style="text-align: left;background-image:url('#{ev.image}');background-size:600px;background-repeat: no-repeat;">
                                        <div class="tranbox">

                                            <div class="caption">
                                                <!--                                                        <c:if test="{ev.type =='new'}">
                                                                                                            <i class="fa fa-bell fa-2x fa-fw" style="color: red ;"></i>
                                                                                                        </c:if>-->
                                                <ul class="nav nav-pills">
                                                   
                                                    <li class="active"><a href="#">Joined count<span class="badge">#{ev.joinedCount}</span></a></li>

                                                    <c:if test="#{ev.status == 'Join'}">
                                                        <li class="active"><a href="#" style="height: 40px;"><h:commandButton  value="Join now" action="#{eventLibraryController.registerEvent(ev.eventId)}" style="background: #b84d45;border: 0px;"></h:commandButton></a></li>
                                                    </c:if>
                                                </ul>
                                                <h3>#{ev.name}</h3>
                                                <p>#{ev.description}</p>
                                                <a>#{ev.timeStart}</a><br/><a>#{ev.timeEnd}</a><br/><br/>
                                                <a class="btn btn-default" href="EventDetail.xhtml?eventId=#{ev.eventId}">More »</a>

                                                <span class="comments" style="float: right;color: #4cae4c;">
                                                    <i class="fa fa-comments-o  fa-2x"></i>
                                                    #{ev.commnetCount}
                                                </span>	
                                            </div>
                                        </div>
                                    </div>
                                </div>	  
                            </h:form>
                        </c:forEach>
                    </c:when>
                    <c:otherwise><p>null</p></c:otherwise>
                </c:choose>
            </div>

        </div>
        <c:if test="#{eventLibraryController.noOfRecords >6}">
            <div id="pagging" style="text-align: center;">
                <h:form>
                    <ul class="pagination">
                        <c:if test="#{eventSearchController.currentPages!=1}">
                            <li><a href="EventSearch.xhtml?pages=#{eventSearchController.pages=eventSearchController.currentPages-1}">Previous</a></li>
                        </c:if>
                        <c:forEach begin="1" end="#{eventSearchController.noOfPage}" var="i">
                            <c:choose>
                                <c:when test="#{eventSearchController.currentPages eq i}">
                                    <li class="active"><a>#{i}</a></li>
                                </c:when>
                                <c:otherwise>
                                    <li><a href="EventSearch.xhtml?pages=#{eventSearchController.pages=i}">#{i}</a></li>
                                </c:otherwise>
                            </c:choose>
                        </c:forEach>
                        <c:if test="#{eventSearchController.currentPages lt eventSearchController.noOfPage}">
                            <li><a href="EventSearch.xhtml?pages=#{eventSearchController.pages=eventSearchController.currentPages+1}">Next</a></li>
                        </c:if>
                    </ul>
                </h:form>

            </div>
        </c:if>
        <script src="js/bootstrap.min.js" type="text/javascript"></script>
    </ui:define>

</ui:composition>
